<?php
namespace Hive\Workflow;
/**
 * Workflow Step
 * 
 * It represent a step of the workflow process. Each step can have a parent step, to be use to rebuilt the 
 *
 * @author Xavier VILAIN
 * @package Hive\Workflow
 *
 * @property int	$wid			Id of the Workflow
 * @property int	$stepid			Id of the step
 * @property string	$language		Language of the label
 * @property int	$position		Order
 * @property int	$parentid		Id of the parent step (can be null)
 * @property string	$label			Status/Label of the step
 * @property int	$type			Type of step (1:standard,9:out)
 */
class Step  extends \Fox\Object\Customizing {
	
	/**
	 * Link to parent Workflow Header data
	 * @var string
	 */
	const LINK_WORKFLOW = 'workflow';
	
	/**
	 * Standard Step
	 * @var int
	 */
	const TYPE_STANDARD = '1';
	
	/**
	 * Closing Step
	 * @var int
	 */
	const TYPE_CLOSING = '9';
	
	/**
	 * Check if its a closing step
	 * @return bool
	 */
	public function isClosing() {
		if($this->type == self::TYPE_CLOSING) {
			return true;
		} 
		return false;
	}
}
\Fox\Dao::infos(Step::className(),new \Fox\Object\Info('workflow_steps', \Fox\Databases::DB_APP));
// Link to i18n elements
\Fox\Object\Links::add(\Fox\Dao::link(Step\I18n::className(),Step::LINK_SOURCE_REFERENCE)
->to(Step::className(), Step::LINK_I18N)
->on('stepid')
//->cache(new \Fox\Dao\MemoryCacheZone(\Fox\Dao\MemoryCacheZone::PERIOD_FOREVER,Step::cacheDirectory()))
->versionFrom());